<template>
    <div class="keyBorad">
        <div class="item" :class="{'active' : up}">↑</div>
        <br>
        <div class="item" :class="{'active' : left}">←</div>
        <div class="item" :class="{'active' : down}">↓</div>
        <div class="item" :class="{'active' : right}">→</div>
    </div>
</template>

<script>
import keyEvent from './keyBorad'

export default {
    data() {
        return {
            up: false,
            down: false,
            left: false,
            right: false,
        }
    },
    mounted() {
        keyEvent.on('alt+add', () => this.up = true, () => this.up = false);
    }
}
</script>

<style>
    .keyBorad { text-align: center;}
    .item { display: inline-block; width: 50px; height: 40px; line-height: 40px; border-radius: 5px; border: 1px solid #ccc; margin: 5px;}
    .item.active { background-color: #aaa; color: #fff; }
</style>